//
// Created by 11510 on 2025/10/2.
//

#include "HelpCommand.h"

xclib_client::HelpCommand::HelpCommand(CommandContext ctx) : ICommand("help", ctx) {}

std::optional<std::future<int>> xclib_client::HelpCommand::run(const std::vector<std::string> &args, bool wait) {
    (void) args;
    (void) wait;
    auto cmds = CommandFactory::instance().listCommands();
    std::cout << "Available commands:\n";
    for (auto &c: cmds)
        std::cout << "  " << c << '\n';
    return std::nullopt;
}

std::string xclib_client::HelpCommand::shortHelp() const { return "show all command"; }

std::string xclib_client::HelpCommand::longHelp() const { return "help\n    show all available commands"; }